package com.qlm.tool;

import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.jfinal.kit.HttpKit;
import com.jfinal.weixin.sdk.utils.JsonUtils;

/**
 * 发送异步请求
 * 
 * @author wangzih
 *
 */
public class HTTPUtil {

	private static Logger logger = LoggerFactory.getLogger(HTTPUtil.class);

	public static void get(final String url, final Map<String, String> param) {
		new Thread(new Runnable() {
			public void run() {
				HttpKit.get(url, param);
				logger.info("发送get请求到,url:"+url+",参数:"+param);
			}
		}).start();
	}
	
	public static void post(final String url,final Map<String, String> param) {
		new Thread(new Runnable() {
			public void run() {
				String json = JsonUtils.toJson(param);
				HttpKit.post(url, json);
				logger.info("发送post请求到,url:"+url+",参数:"+json);
			}
		}).start();
	}
	
}
